function isNumber(oNum){
  if(!oNum) return false;
  var strP=/^\d+(\.\d+)?$/;
  if(!strP.test(oNum)) return false;
  try{
 	 if(parseFloat(oNum)!=oNum) return false;
  }catch(ex){
   return false;
  }
  return true;
}


/**
formName form名
name 要得到值的radio的名称
**/
function getRadioCheckedValue(formName,name){
	var fm=document.getElementsByName(formName)[0];
	var olist =fm.elements;
	for(i=0;i<olist.length;i++){
			if(olist[i].name==name && olist[i].type=='radio' && olist[i].checked==true){
				return olist[i].value;
			}
	}
	return null;
}

function setTextValue(objName,_value){
	if(_value.length<1)return;
	var obj=document.getElementById(objName);
	obj.value=_value;
}

function selectCheckbox(field,check){
	var obj=document.getElementById(field);
	obj.value=(check==true?"1":"0");
}

function checkboxIsSelect(name){
	var ck= document.getElementsByName(name);  
	if(ck==undefined)return false;
	for(i=0;i<ck.length;i++){
		if(ck[i].checked==true)return true;
	}
	return false;	
}

function local(url){
	location = url;
}


function isPost(msg,url){ 
     if(confirm(msg)){
		location=url;
	}
} 

//让一个层打开/关闭
function ctrlDiv(divId){
	if(document.getElementById(divId)==null)return;
	var _style=document.getElementById(divId).style;
	if(_style.display=="none"){
	_style.display="block";
	}else{
	_style.display="none";
	}
}

//选择中一个item
function jsSelectItemByValue(objSelect, objItemValue) {                  
    for (var i = 0; i < objSelect.options.length; i++) {    
        //if (objSelect.options.value == objItemValue) {  
		if (objSelect.options[i].value == objItemValue) { 
            objSelect.options[i].selected = true;               
            break;        
        }        
    } 
}

//得到系统的当前时间
function   date2str(d){   
  var ret=d.getFullYear()+"-";
  ret+=("00"+(d.getMonth()+1)).slice(-2)+"-";
  ret+=("00"+d.getDate()).slice(-2)+" ";
  ret+=("00"+d.getHours()).slice(-2)+":";
  ret+=("00"+d.getMinutes()).slice(-2)
  //ret+=("00"+d.getMinutes()).slice(-2)+":"; 
 // ret+=("00"+d.getSeconds()).slice(-2)  ; 

  return   ret;   
} 

//表格行变颜色
function updateTrColor(table,oldColor,newColor){
	if(table==null)table="js_table";
	if(oldColor==null)oldColor="#FAFAFA";
	if(newColor==null)newColor="#B9F1FF";
	var tablename=document.getElementById(table);
	var li=tablename.getElementsByTagName("tr");
	for (var i=0;i<=li.length;i++){
		if(li[i]==null || li[i].style==null)continue;
		li[i].style.backgroundColor=oldColor;
		
		li[i].onmouseover=function(){
			this.style.backgroundColor=newColor;
		}
		li[i].onmouseout=function(){
			this.style.backgroundColor=oldColor;
		}
	}
}

   var childWindow=null;
 //选择设备
   function selectEqpInfo(targetId,targetName,stockId,entityName,isShowAddEqp){
	   closeChild();
	  childWindow=window.open("eqpInfoAction_selectEqp.do?targetId="+targetId+"&targetName="+targetName+"&stockId="+stockId+"&entityName="+entityName+"&isShowAddEqp="+isShowAddEqp,"","Height=450,Width=900,scrollbars=yes,resizable=no,location=no,status=no,left=200,top=100");
	 // alert(childWindow);
	  //childWindow
  }
   
   // 如果已经有子窗口打开，则关闭
	function  closeChild() {
		if (childWindow && childWindow.open && !childWindow.closed) {
			childWindow.close();
		}
	}
   function showSearchDiv(obj){
	   document.getElementById('search_div').style.display = document.getElementById('search_div').style.display == ''?'none':'';
	   obj.className = obj.className=="search_show_style"?"search_hidden_style":"search_show_style";
   }

